﻿using System.Windows.Forms;

namespace Badge_Manager.Utility
{
    public partial class frmInputBox : Form
    {
        public string daRitornare;

        public frmInputBox(string caption, string label)
        {
            InitializeComponent();
            this.Text = caption;
            lblModificaDaCodice.Text = label;
            this.txtInserito.Focus();
            this.txtInserito.KeyPress += new System.Windows.Forms.KeyPressEventHandler(CheckKeys);
            this.Left = 450;
            this.Top = 250;
        }

        private void CheckKeys(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)13)
            {
                daRitornare = txtInserito.Text.Trim();
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }

        private void btnOk_Click(object sender, System.EventArgs e)
        {
        }

        private void frmInputBox_Load(object sender, System.EventArgs e)
        {
        }

        private void btnAnnulla_Click(object sender, System.EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}